/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: #000;
    color: #fff;
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Main game container - responsive sizing */
#gameContainer {
    position: relative;
    width: 100%;
    height: 450px;
    max-width: 800px;
    background: linear-gradient(180deg, #000428 0%, #004e92 100%);
    border: 2px solid #00ffff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

/* Responsive height for full screen */
@media (min-height: 500px) and (min-width: 900px) {
    #gameContainer {
        height: 90vh;
        max-height: 90vh;
    }
}

/* Game canvas - fills container */
#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 1;
}

/* UI overlay positioning */
#gameUI {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

/* Instruction panel at top */
#instructionPanel {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    padding: 8px 16px;
    border-radius: 20px;
    border: 2px solid #00ffff;
    pointer-events: auto;
}

#instruction {
    font-size: 16px;
    font-weight: bold;
    color: #00ffff;
    text-align: center;
    cursor: help;
    transition: all 0.3s ease;
}

#instruction:hover {
    color: #ffff00;
    transform: scale(1.05);
}

/* Stats panel in top right */
#statsPanel {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    padding: 10px;
    border-radius: 10px;
    border: 1px solid #00ffff;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 14px;
}

.stat-label {
    color: #aaa;
}

#score, #level, #lives {
    color: #00ffff;
    font-weight: bold;
}

/* Feedback panel for showing results */
#feedbackPanel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 20px;
    border-radius: 15px;
    border: 2px solid #00ff00;
    text-align: center;
    opacity: 0;
    transition: all 0.5s ease;
    pointer-events: none;
    max-width: 300px;
}

#feedbackPanel.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}

#feedback {
    font-size: 18px;
    font-weight: bold;
    color: #00ff00;
}

#feedbackPanel.wrong {
    border-color: #ff0000;
}

#feedbackPanel.wrong #feedback {
    color: #ff0000;
}

/* Control panel for start/pause buttons */
#controlPanel {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    pointer-events: auto;
}

button {
    background: linear-gradient(45deg, #00ffff, #0080ff);
    border: none;
    color: #000;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 255, 255, 0.3);
    min-height: 44px;
    min-width: 100px;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 255, 255, 0.5);
    background: linear-gradient(45deg, #00ff00, #00aa00);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 255, 255, 0.3);
}

button:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Mobile controls at bottom */
#mobileControls {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    gap: 15px;
    pointer-events: auto;
}

#mobileControls button {
    width: 60px;
    height: 50px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 10px;
    padding: 8px;
}

#shoot {
    background: linear-gradient(45deg, #ff4444, #cc0000);
    color: #fff;
}

#shoot:hover {
    background: linear-gradient(45deg, #ff6666, #ff0000);
}

/* Tooltip styling */
#tooltip {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.9);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #00ffff;
    font-size: 12px;
    line-height: 1.4;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    max-width: 250px;
    z-index: 10;
}

#gameContainer:hover #tooltip {
    opacity: 1;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    #mobileControls {
        display: flex;
    }
    
    #instructionPanel {
        top: 5px;
        padding: 6px 12px;
    }
    
    #instruction {
        font-size: 14px;
    }
    
    #statsPanel {
        top: 5px;
        right: 5px;
        padding: 8px;
        font-size: 12px;
    }
    
    #controlPanel {
        bottom: 70px;
    }
    
    button {
        padding: 10px 20px;
        font-size: 14px;
        min-height: 40px;
        min-width: 80px;
    }
    
    #tooltip {
        font-size: 11px;
        padding: 10px;
        max-width: 200px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    button {
        min-height: 48px;
        min-width: 48px;
    }
    
    #mobileControls button {
        width: 70px;
        height: 60px;
    }
}

/* Animation classes for game elements */
.pulse {
    animation: pulse 0.5s ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Glow effects for interactive elements */
.glow {
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.8);
}

.hit-effect {
    animation: hitFlash 0.3s ease-out;
}

@keyframes hitFlash {
    0% { background-color: rgba(255, 255, 255, 0); }
    50% { background-color: rgba(255, 255, 255, 0.8); }
    100% { background-color: rgba(255, 255, 255, 0); }
}